﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="CompanySelect.aspx.cs" Inherits="EarlyWarning_CompanySelect" %>

<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../style.css" />
    <link rel="Stylesheet" type="text/css" href="../style-floating.css" />
    <link rel="Stylesheet" type="text/css" href="../Style/global.css" />
    <script type="text/javascript" src="../Scripts/jquery.js"></script>
    <script type="text/javascript" src="../Scripts/MainListSelect.js"></script>
    <script type="text/jscript">

        function addCompanyInfo() {


            CheckBoxList = document.getElementsByName("chkHospital");
            var resultValue = "", nameList = "", idList = "";

            for (var i = 0; i < CheckBoxList.length; i++) {
                if (CheckBoxList[i].checked) {
                    resultValue = CheckBoxList[i].value;
                    tempId = resultValue.split("|")[0];
                    tempName = resultValue.split("|")[1];

                    idList = idList + tempId + ",";
                    nameList = nameList + tempName + ",";
                }
            }

            var CompanyInfo;
            if (idList.length > 1 && nameList.length>1) {
                idList = idList.substring(0, idList.length-1);
                nameList = nameList.substring(0, nameList.length-1);
            }
            CompanyInfo = nameList + "|" + idList;
            window.opener.InsertCompany(CompanyInfo);
            window.close();
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div id="tabcontent">
            <center>
                <table border="0" width="50%">
                    <tr align="center">
                        <td class="mainlist">
                            名称:<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                            <asp:Button ID="btnEnter" runat="server" Text="查询" OnClick="btnEnter_Click" />
                        </td>
                    </tr>
                    <tr align="center">
                        <td>
                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  Width="100%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CssClass="mainlist">
                                <Columns>
                                    <asp:TemplateField HeaderText=" ">
                                        <HeaderTemplate>
                                            <input id="chkAllCompany" name="chkAll" type="checkbox" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                             <input id="chkHospital" name="chkHospital" type="checkbox" value='<%#Eval("CompanyId") %>|<%# Eval("companyname") %>'>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="企业名称" DataField="companyname" />
                                </Columns>
                            </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                    <td align="center">
                        <input type="button" id="Save" onclick="javascript:addCompanyInfo()" value="保存" />
                    </td>
                  </tr>
                </table>
            </center>
        </div>
        <div class="page">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="30">
            </webdiyer:AspNetPager>
        </div>
    </form>
</body>
</html> 